package com.poqop.document;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import android.graphics.Bitmap;

public class SaveBitMap {
	
	public static void saveMyBitmap(Bitmap bitmap,String bitName) {
		String dirpath = android.os.Environment
		.getExternalStorageDirectory().getAbsolutePath() + "/food";
        File f = new File(dirpath +"/"+ bitName + ".png");
        try {
			f.createNewFile();
		} catch (IOException e1) {
			e1.printStackTrace();
		}
        FileOutputStream fOut = null;
        try {
                fOut = new FileOutputStream(f);
        } catch (FileNotFoundException e) {
                e.printStackTrace();
        }
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
        try {
                fOut.flush();
        } catch (IOException e) {
                e.printStackTrace();
        }
        try {
                fOut.close();
        } catch (IOException e) {
                e.printStackTrace();
        }
}
}
